import numpy as np

def bandpass_filter(x,sample_rate,fl,fh):
    N = len(x)
    xf = np.fft.fft(x)
    nl = fl/sample_rate*N
    nh = fh/sample_rate*N
    for i in range(N):
        if i < nl or i >= nh:
            xf[i] = 0
    y = np.real(np.fft.ifft(xf))
    return y